﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
namespace REPORT.DAL
{
    public class DAL_NGUOIDUNG
    {
        public DataTable AutoTenNV()
        {
            DataTable dt = new DataTable();
            DbProvider db = new DbProvider();
            string sql = @"select ho_ten from nguoidung";
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex) { throw new Exception(ex.Message); }
            return dt;
        }
        public SqlDataReader LayMaNV(string tennv)
        {
            SqlDataReader sqlrd;
            DbProvider db = new DbProvider();
            string sql = @"select ma_nguoi_dung from nguoidung where ho_ten=N'" + tennv + "'";
            try
            {
                sqlrd = db.ExcuteReader(sql);
            }
            catch (Exception ex) { throw new Exception(ex.Message); }
            return sqlrd;
        }
        public DataTable ThongTinNhanVien(int manv)
        {
            DataTable dt = new DataTable();
            DbProvider db = new DbProvider();
            string sql = @"select * from nguoidung where ma_nguoi_dung=N'" + manv + "'";
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex) { throw new Exception(ex.Message); }
            return dt;
        }
    }
}
